package org.bspv.pharma.manager.impl;

import java.util.List;

import org.bspv.pharma.dao.SupplyDAO;
import org.bspv.pharma.manager.SupplyManager;
import org.bspv.pharma.model.Place;
import org.bspv.pharma.model.Supply;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 
 * @author guillaume
 * 
 */
@Service(value = "supplyManager")
public class SupplyManagerImpl extends AbstractManagerImpl<Supply, Long>
		implements SupplyManager {

    /**
     * Constructeur par défaut.
     * @param dao
     */
	@Autowired
	public SupplyManagerImpl(SupplyDAO dao) {
		super(dao);
	}

	/**
	 * {@inheritDoc}
	 */
    @Override
	public List<Supply> findSupplies(Place place) {
		String[] empty = {};
		String[] keys = { "place" };
		Object[] values = { place };
		String[] nullProperties = { "destructionDate" };
		return dao.findBy(keys, values, nullProperties, empty);
	}

    /**
     * {@inheritDoc}
     */
    @Override
    public List<Supply> findSupplies(List<Place> places) {
        return ((SupplyDAO) dao).findSupplies(places);
    }

}
